//
//  CinemaInfo.m
//  EasyToo
//
//  Created by 郑 哲 on 9/6/13.
//
//

#import "CinemaInfo.h"

@implementation CinemaInfo

- (id)initWithDictionary:(NSDictionary *)jsonDictionary
{
    self = [self init];
    if (self) {
        NSDictionary *dict = GetDictionaryDictionary(jsonDictionary, @"ShowList");
        
        self.cinemaId = GetDictionaryStringDefaultNil(dict, @"cinemaId");
        self.showdate = GetDictionaryStringDefaultNil(dict, @"showdate");
        
        NSArray *showJsonArray = GetDictionaryArrayDefaultNil(dict, @"Show");
        if (showJsonArray)
        {
            self.ShowList = [[NSMutableArray alloc] init];
            for (int i = 0; i < [showJsonArray count]; i++)
            {
                NSDictionary *showDict = [showJsonArray objectAtIndex:i];
                
                ShowInfo *showInfo = [[ShowInfo alloc] initWithDictionary:showDict];
                
                [self.ShowList addObject:showInfo];
            }
        }

    }
    return self;
}
@end

@implementation ShowInfo

- (id)initWithDictionary:(NSDictionary *)jsonDictionary
{
    self = [self init];
    if (self) {
        self.foretellId = GetDictionaryStringDefaultNil(jsonDictionary, @"foretellId");
        self.hallId = GetDictionaryStringDefaultNil(jsonDictionary, @"hallId");
        self.hallName = GetDictionaryStringDefaultNil(jsonDictionary, @"hallName");
        self.showtime = GetDictionaryStringDefaultNil(jsonDictionary, @"showtime");
        self.fee = GetDictionaryStringDefaultNil(jsonDictionary, @"fee");
        self.marketPrice = GetDictionaryStringDefaultNil(jsonDictionary, @"marketPrice");
        self.duration = GetDictionaryStringDefaultNil(jsonDictionary, @"duration");
        self.price = GetDictionaryStringDefaultNil(jsonDictionary, @"price");
    }
    return self;
}

@end
